import api from './api';
import { Project, ApiResponse, PaginationParams, PaginationResult } from './types';

export const projectApi = {
  startScan: (ip: string) => api.get<ApiResponse<Project>>('/project/start', { params: { cidr: ip } }) as unknown as Promise<ApiResponse<Project>>,
  getProjects: (params?: PaginationParams) => api.get<ApiResponse<PaginationResult<Project>>>('/project', { params }) as unknown as Promise<ApiResponse<PaginationResult<Project>>>,
  getProject: (id: number) => api.get<Project>(`/project/${id}`) as unknown as Promise<ApiResponse<Project>>,
  updateProject: (id: number, data: Partial<Project>) => api.put<Project>(`/project/${id}`, data) as unknown as Promise<ApiResponse<Project>>,
  deleteProject: (id: number) => api.delete<ApiResponse<Project>>(`/project/${id}`) as unknown as Promise<ApiResponse<Project>>,
}; 